<template>
  <div>
    addreceivingaddress
    <van-row type="flex" align="center">
      <van-col span="2">
        <van-icon
          name="arrow-left"
          size="40"
          color="rgb(64, 150, 236)"
          @click="back"
        />
      </van-col>

      <van-col span="8" offset="6">新增收货地址</van-col>
      <!-- <van-col span="4" offset="1" @click="done">完成</van-col> -->
    </van-row>
    <hr style="margin-top:20px,color:rgba(137, 162, 162, 0.1)" />

    <van-address-edit
      :area-list="areaList"
      show-set-default
      show-search-result
      :search-result="searchResult"
      :area-columns-placeholder="['请选择', '请选择', '请选择']"
      @save="onSave"
      @change-detail="onChangeDetail"
    />
  </div>
</template>

<script>
import { Toast } from "vant";
const areaList = {
  province_list: {
    110000: "北京市",
    120000: "天津市",
  },
  city_list: {
    110100: "北京市",
    120100: "天津市",
  },
  county_list: {
    110101: "东城区",
    110102: "西城区",
    120101: "天津一号",
    120102: "天津2号",
    // ....
  },
};
export default {
  data() {
    return {
      areaList,
      searchResult: [],
      addressObj:{

      }
    };
  },
  methods: {
    onSave() {
      // 收集信息

      // Toast("save");
      console.log(this.aa);

    },
    onDelete() {
      Toast("delete");
    },
    back() {
      this.$router.go(-1);
    },
    done() {
      this.$router.push("/selectshippingaddress");
    },
    onChangeDetail(val) {
      console.log(this.searchResult[0]);
      if (val) {
        this.searchResult = [
          {
            name: "成都",
            address: "w279",
          },
        ];
      } else {
        this.searchResult = [];
      }
    },
  },
 
};
</script>

<style>
</style>